package top.hidoctor.auscultation.feature.activity;

import android.os.Bundle;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.View;

import java.util.ArrayList;
import java.util.List;

import top.hidoctor.auscultation.R;
import top.hidoctor.auscultation.adapter.ExampleChooseAdapter;
import top.hidoctor.auscultation.adapter.ExampleListAdapter;
import top.hidoctor.auscultation.base.BaseActivity;

public class ExampleListActivity extends BaseActivity {
    private RecyclerView recycler;
    private List<String> list = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.act_example_list);
        initView();
        initEvent();
    }

    private void initEvent() {
        for (int i = 0; i < 10; i++) {
            list.add(i + "");
        }
        recycler.setLayoutManager(new LinearLayoutManager(this));
        recycler.setAdapter(new ExampleListAdapter(R.layout.item_example_list, list));
        recycler.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
    }

    private void initView() {
        Toolbar toolbar = findViewById(R.id.toolbar);
        toolbar.setNavigationIcon(R.mipmap.ic_back_left);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });
        recycler = findViewById(R.id.recycler);
    }
}
